import request from '@/config/axios'

// 会议室预约 VO
export interface MeetingReserveVO {
  id: number // 编号
  title: string // 会议主题
  schoolCode: string // 园区
  roomId: number // 会议室ID
  userIds: string // 参会人员
  userNames: string // 参会人员姓名
  userName: string // 预约人
  startTime: Date // 会议开始时间
  endTime: Date // 会议结束时间
  fileUrls: string // 会议纪要文件
  status: number // 状态
}

// 会议室预约 API
export const MeetingReserveApi = {
  // 查询会议室预约分页
  getMeetingReservePage: async (params: any) => {
    return await request.get({ url: `/school/meeting-reserve/page`, params })
  },

  // 查询会议室预约详情
  getMeetingReserve: async (id: number) => {
    return await request.get({ url: `/school/meeting-reserve/get?id=` + id })
  },

  // 新增会议室预约
  createMeetingReserve: async (data: MeetingReserveVO) => {
    return await request.post({ url: `/school/meeting-reserve/create`, data })
  },

  // 修改会议室预约
  updateMeetingReserve: async (data: MeetingReserveVO) => {
    return await request.put({ url: `/school/meeting-reserve/update`, data })
  },

  // 会议室预约审核
  approveMeetingReserve: async (data: any) => {
    return await request.put({ url: `/school/meeting-reserve/approve`, data })
  },

  // 取消议室预约
  cancelMeetingReserve: async (id: number) => {
    return await request.put({ url: `/school/meeting-reserve/cancel?id=` + id })
  },

  // 删除会议室预约
  deleteMeetingReserve: async (id: number) => {
    return await request.delete({ url: `/school/meeting-reserve/delete?id=` + id })
  },

  // 导出会议室预约 Excel
  exportMeetingReserve: async (params) => {
    return await request.download({ url: `/school/meeting-reserve/export-excel`, params })
  },
  // 根据月份查询会议预约情况
  getMeetingReserveByMonth: async (month: string) => {
    return await request.get({ url: `/school/meeting-reserve/get-by-month?month=${month}` })
  },
  // 查询某天会议预约列表
  getMeetingReserveByDay: async (day: string) => {
    return await request.get({ url: `/school/meeting-reserve/get-by-day?day=${day}` })
  }
}
